package com.google.common.collect;

import com.google.common.base.Preconditions;

import java.util.Collection;

public final class Iterables {
    private Iterables() {
    }
    public static <T> boolean addAll(Collection<T> addTo, Iterable<? extends T> elementsToAdd) {
        if (elementsToAdd instanceof Collection) {
            return addTo.addAll((Collection<? extends T>) elementsToAdd);
        } else {
            return Iterators.addAll(addTo, ((Iterable) Preconditions.checkNotNull(elementsToAdd)).iterator());
        }
    }
}
